home *** CD-ROM | disk | FTP | other *** search
/ Young Minds / Young Minds Interactive CD-ROM.ISO / conquest / reports.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-10-26  |  16.7 KB  |  646 lines

  1. /*conquest is copyrighted 1986 by Ed Barlow.
  2.  *  I spent a long time writing this code & I hope that you respect this.  
  3.  *  I give permission to alter the code, but not to copy or redistribute
  4.  *  it without my explicit permission.  If you alter the code, 
  5.  *  please document changes and send me a copy, so all can have it.  
  6.  *  This code, to the best of my knowledge works well,  but it is my first
  7.  *  'C' program and should be treated as such.  I disclaim any
  8.  *  responsibility for the codes actions (use at your own risk).  I guess
  9.  *  I am saying "Happy gaming", and am trying not to get sued in the process.
  10.  *                                                Ed
  11.  */
  12.  
  13.  
  14. /*    screen subroutines    */
  15.  
  16. /*include files*/
  17. #include <ctype.h>
  18. #include "header.h"
  19.  
  20. extern FILE *fexe;
  21. extern short country;
  22. extern int startgold;
  23.  
  24. /*report on armies and allow changes*/
  25. armyrpt()
  26. {
  27.     int i,j;
  28.     int chg;
  29.     short army;
  30.     int men;
  31.     int oldx,oldy;
  32.     short oldarmy;
  33.     int done=0;
  34.     int position;
  35.     int isgod=0;
  36.     int count;    /*number of armies on current screen */
  37.     short armynum=0;    /*current nation id */
  38.     if(country==0) {
  39.         standout();
  40.         isgod=1;
  41.         clear();
  42.         mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
  43.         clrtoeol();
  44.         standend();
  45.         refresh();
  46.         echo();
  47.         scanw("%hd",&country);
  48.         if(country<0||country>NTOTAL) return;
  49.         noecho();
  50.     }
  51.     armynum=0;
  52.     /*new army screen*/
  53.     while(done==0) {
  54.         clear();
  55.         /*Operate on any armies that you wish*/
  56.         standout();
  57.         mvprintw(0,(COLS/2)-20,"ARMY STATS SUMMARY FOR %s",ntn[country].name);
  58.         standend();
  59.         /* give a army report */
  60.  
  61.         mvaddstr(3,0,"soldiers  :");
  62.         mvaddstr(4,0,"movement  :");
  63.         mvaddstr(5,0,"x location:");
  64.         mvaddstr(6,0,"y location:");
  65.         mvaddstr(7,0,"status    :");
  66.  
  67.         position=5;
  68.         count=0;
  69.         while((armynum<MAXARM)&&(count!=6)){
  70.             if(ASOLD>0) {
  71.                 count++;
  72.                 position+=10;
  73.                 standout();
  74.                 mvprintw(2,position,"%d:",armynum);
  75.                 standend();
  76.                 mvprintw(3,position,"%d",ASOLD);
  77.                 mvprintw(4,position,"%d",AMOVE);
  78.                 mvprintw(5,position,"%d",AXLOC);
  79.                 mvprintw(6,position,"%d",AYLOC);
  80.                 mvprintw(7,position,"%s",*(soldname+ASTAT));
  81.             }
  82.             armynum++;
  83.         }
  84.         if(armynum>=MAXARM) done=1;
  85.  
  86.         standout();
  87.         mvaddstr(12,(COLS/2)-10,"HIT SPACE KEY IF DONE");
  88.         mvaddstr(13,(COLS/2)-14,"HIT RETURN TO CHANGE AN ARMY");
  89.         mvaddstr(14,(COLS/2)-14,"HIT ANY OTHER KEY TO CONTINUE");
  90.         standend();
  91.         refresh();
  92.         if ((army=getch())==' ') done=1;
  93.         if (army=='\n'){
  94.             mvaddstr(16,0,"WHAT ARMY DO YOU WANT TO CHANGE:");
  95.             clrtoeol();
  96.             refresh();
  97.             echo();
  98.             scanw("%hd",&armynum);
  99.             noecho();
  100.             if((armynum<0)||(armynum>MAXARM)) return;
  101.             mvaddstr(18,0,"1) CHANGE STATUS, 2) TRANSFER / MERGE, 3) SPLIT ARMY, 4) DISBAND ARMY:");
  102.             clrtoeol();
  103.             if(isgod==1) mvaddstr(20,0,"5) LOCATION, 6) SOLDIERS:");
  104.             refresh();
  105.             switch(getch()){
  106.             case '1':
  107.                 mvaddstr(21,0,"1=MARCH, 2=SCOUT, 3=ATTACK, 4=DEFEND, 5=GARRISON");
  108.                 clrtoeol();
  109.                 refresh();
  110.                 scanw("%d",&chg);
  111.                 if(chg<1) return;
  112.                 if(chg>5) return;
  113.                 if((chg==2)&&(ASOLD>25)){
  114.                     clear();
  115.                     mvaddstr(12,(COLS/2)-6,"NEED < 25 MEN TO SCOUT");
  116.                     mvaddstr(13,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
  117.                     refresh();
  118.                     getch();
  119.                     if(isgod==1) country=0;
  120.                     return;
  121.                 }
  122.                 else if((chg>0)&&(chg<7)) {
  123.                     ASTAT=chg; 
  124.                     AADJSTAT;
  125.                 }
  126.                 break;
  127.             case '2':
  128.                 oldx=AXLOC;
  129.                 oldy=AYLOC;
  130.                 oldarmy=armynum;
  131.                 mvaddstr(22,0,"TO WHAT ARMY: ");
  132.                 clrtoeol();
  133.                 refresh();
  134.                 echo();
  135.                 scanw("%hd",&armynum);
  136.                 if(armynum==oldarmy) {
  137.                     mvprintw(23,0,"SORRY -- SAME (%d,%d",armynum,oldarmy);
  138.                     refresh();
  139.                     getch();
  140.                 }
  141.                 else if((armynum<0)||(armynum>MAXARM)){
  142.                     mvprintw(23,0,"SORRY -- INVALID ARMY %d",armynum);
  143.                     refresh();
  144.                     getch();
  145.                 }
  146.                 else if(ntn[country].arm[oldarmy].stat==SCOUT){
  147.                     mvaddstr(23,0,"SORRY -- ORIGIN ARMY IS SCOUTING");
  148.                     refresh();
  149.                     getch();
  150.                 }
  151.                 else if(ASTAT==SCOUT){
  152.                     mvaddstr(23,0,"SORRY -- TARGET ARMY IS SCOUTING");
  153.                     refresh();
  154.                     getch();
  155.                 }
  156.                 else if((oldx==AXLOC)&&(oldy==AYLOC)&&(ASOLD>0)) {
  157.                     ASOLD+= ntn[country].arm[oldarmy].sold;
  158.                     ntn[country].arm[oldarmy].sold=0;
  159.                     AADJMEN;
  160.                     if(AMOVE>ntn[country].arm[oldarmy].smove)
  161.                         AMOVE=ntn[country].arm[oldarmy].smove;
  162.                     AADJMOV;
  163.                     armynum=oldarmy;
  164.                     AADJMEN;
  165.                 }
  166.                 else {
  167.                     mvaddstr(23,0,"Armies not together (hit any key) ");
  168.                     refresh();
  169.                     getch();
  170.                 }
  171.                 noecho();
  172.                 break;
  173.             case '3':
  174.                 mvaddstr(21,0,"HOW MANY MEN TO SPLIT: ");
  175.                 clrtoeol();
  176.                 refresh();
  177.                 echo();
  178.                 scanw("%d",&men);
  179.                 noecho();
  180.                 if((armynum<0)||(armynum>MAXARM)) return;
  181.                 if((men<25)||(ASOLD-men<25)){
  182.                     mvaddstr(23,0,"TOO FEW MEN TRANSFERED OR LEFT");
  183.                     refresh();
  184.                     getch();
  185.                 }
  186.                 else if(men<ASOLD){
  187.                     ASOLD-=men;
  188.                     AADJMEN;
  189.                     oldarmy=armynum;
  190.                     oldx=AXLOC;
  191.                     oldy=AYLOC;
  192.                     armynum=(-1);
  193.                     for(army=0;army<MAXARM;army++)
  194.                         if(ntn[country].arm[army].sold==0){
  195.                             if(armynum==(-1)) armynum=army;
  196.                         }
  197.                     /*overflow*/
  198.                     if(armynum==(-1)) {
  199.                         mvaddstr(23,0,"TOO MANY ARMIES: ");
  200.                         armynum=oldarmy;
  201.                         ASOLD+=men;
  202.                         AADJMEN;
  203.                     }
  204.                     else {
  205.                         AMOVE=ntn[country].arm[oldarmy].smove;
  206.                         ASTAT=DEFEND;
  207.                         AXLOC=oldx;
  208.                         AYLOC=oldy;
  209.                         ASOLD=men;
  210.                         AADJSTAT;
  211.                         AADJMEN;
  212.                         AADJLOC;
  213.                         AADJMOV;
  214.                     }
  215.                 }
  216.                 else {
  217.                     mvaddstr(23,0,"TOO MANY MEN : ");
  218.                     refresh();
  219.                     getch();
  220.                 }
  221.                 break;
  222.             case '4':
  223.                 if(sct[AXLOC][AYLOC].owner!=country){
  224.                     mvaddstr(21,0,"YOU DONT OWN SECTOR-- hit return");
  225.                     clrtoeol();
  226.                     refresh();
  227.                     getch();
  228.                 }
  229.                 else if(magic(country,VAMPIRE)==1){
  230.                     mvaddstr(21,0,"VAMPIRES CANT DISBAND--hit return");
  231.                     clrtoeol();
  232.                     refresh();
  233.                     getch();
  234.                 }
  235.                 else {
  236.                     i=AXLOC;
  237.                     j=AYLOC;
  238.                     sct[i][j].people+=ASOLD;
  239.                     ASOLD=0;
  240.                     AADJMEN;
  241.                     SADJCIV2;
  242.                 }
  243.                 break;
  244.             case '5':
  245.                 if(isgod==1){
  246.                     /*X LOCATION*/
  247.                     mvaddstr(21,0,"WHAT IS THE NEW X LOC: ");
  248.                     refresh();
  249.                     echo();
  250.                     scanw("%d",&men);
  251.                     AXLOC=men;
  252.                     /*Y LOCATION*/
  253.                     mvaddstr(21,0,"WHAT IS THE NEW Y LOC: ");
  254.                     refresh();
  255.                     scanw("%d",&men);
  256.                     noecho();
  257.                     AYLOC=men;
  258.                     AADJLOC;
  259.                 }
  260.                 break;
  261.             case '6':
  262.                 if(isgod==1){
  263.                     /*SOLDIERS*/
  264.                     mvaddstr(21,0,"WHAT IS THE NEW TOTAL SOLDIERS: ");
  265.                     refresh();
  266.                     echo();
  267.                     scanw("%d",&men);
  268.                     noecho();
  269.                     ASOLD=men;
  270.                     AADJMEN;
  271.                 }
  272.                 break;
  273.             default:
  274.                 mvaddstr(21,0,"ERROR : HIT ANY CHAR TO CONTINUE");
  275.                 clrtoeol();
  276.                 refresh();
  277.                 getch();
  278.             }
  279.             noecho();
  280.             armynum=0;
  281.         }
  282.     }
  283.     if(isgod==1) country=0;
  284. }
  285.  
  286. budget()
  287. {
  288.     register int xsctr,ysctr;
  289.     short armynum,nvynum;
  290.  
  291.     int ingold=0,iniron=0,infood=0,incap=0,incity=0;
  292.     int revgold=0,reviron=0,revfood=0;
  293.     int expship=0,expsold=0;
  294.     int isgod=0;
  295.     if(country==0) {
  296.         isgod=1;
  297.         clear();
  298.         mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
  299.         clrtoeol();
  300.         refresh();
  301.         echo();
  302.         scanw("%hd",&country);
  303.         noecho();
  304.     }
  305.     clear();
  306.     standout();
  307.     mvaddstr(0,(COLS/2)-10,"NEXT YEARS BUDGET ESTIMATES");
  308.     standend();
  309.  
  310.     for(xsctr=0;xsctr<MAPX;xsctr++) for(ysctr=0;ysctr<MAPX;ysctr++) if(sct[xsctr][ysctr].owner==country) {
  311.         if(sct[xsctr][ysctr].designation==DFARM){
  312.             infood+= sct[xsctr][ysctr].people;
  313.             revfood+=todigit(sct[xsctr][ysctr].vegitation)*sct[xsctr][ysctr].people*TAXFOOD/100;
  314.         }
  315.         else if(sct[xsctr][ysctr].designation==DMINE) {
  316.             iniron+= sct[xsctr][ysctr].people;
  317.             reviron+=sct[xsctr][ysctr].iron*sct[xsctr][ysctr].people*TAXIRON/100;
  318.         }
  319.         else if(sct[xsctr][ysctr].designation==DGOLDMINE) {
  320.             ingold+= sct[xsctr][ysctr].people;
  321.             revgold+=sct[xsctr][ysctr].gold*sct[xsctr][ysctr].people*TAXGOLD/100;
  322.         }
  323.         else if(sct[xsctr][ysctr].designation==DCAPITOL) incap+= sct[xsctr][ysctr].people;
  324.         else if(sct[xsctr][ysctr].designation==DCITY)    incity+= sct[xsctr][ysctr].people;
  325.     }
  326.     for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) expsold+= ASOLD;
  327.     for(nvynum=0;nvynum<MAXNAVY;nvynum++)
  328.         if(NWAR+NMER>0) expship+=(NWAR+NMER);
  329.  
  330.     standout();
  331.     mvprintw(5,0,  "nation name is ...%s   ",ntn[country].name);
  332.     mvprintw(6,0,  "gold in treasury..$%8ld",ntn[country].tgold);
  333.     standend();
  334.     if(ntn[country].tfood<ntn[country].tciv) standout();
  335.     mvprintw(9,0,  "granary holds ....%8ld",ntn[country].tfood);
  336.     standend();
  337.     mvprintw(10,0, "jewels owned is...%8ld",ntn[country].jewels);
  338.     mvprintw(11,0, "iron ore owned is.%8ld",ntn[country].tiron);
  339.     mvprintw(7,30, "%5d people in gold mines:%8ld",ingold,revgold);
  340.     mvprintw(8,30, "%5d people in iron mines:%8ld",iniron,reviron);
  341.     mvprintw(9,30, "%5d people in farms:     %8ld",infood,revfood);
  342.     mvprintw(10,30,"%5d people in capital:   %8d",incap,incap*TAXCAP/100);
  343.     mvprintw(11,30,"%5d people in cities:    %8d",incity,incity*TAXCITY/100);
  344.     standout();
  345.     mvprintw(12,30,"%5d people TOTAL INCOME: %8d",ntn[country].tciv,revfood+reviron+revgold+(incap*TAXCAP/100)+(incity*TAXCITY/100));
  346.     standend();
  347.  
  348.     if(magic(country,VAMPIRE)!=1) 
  349.     mvprintw(14,30,"%5d troops at %5d each:%8d",expsold,SOLDMAINT,expsold*SOLDMAINT);
  350.     else
  351.     mvprintw(14,30,"%5d troops at     0 each:0",expsold);
  352.     mvprintw(15,30,"%5d ships at %5d each: %8d",expship,SHIPMAINT,expship*SHIPMAINT);
  353.     mvprintw(16,30,"other expenses this turn:  %8ld",startgold-ntn[country].tgold);
  354.     standout();
  355.     mvprintw(17,30,"TOTAL EXPENSES:            %8d",(expsold*SOLDMAINT)+(expship*SHIPMAINT)+startgold-ntn[country].tgold);
  356.     mvprintw(18,30,"NET INCOME:                %8d",revfood+reviron+revgold+(incap*TAXCAP/100)+(incity*TAXCITY/100)-(expsold*SOLDMAINT)-(expship*SHIPMAINT)-startgold+ntn[country].tgold);
  357.     mvaddstr(20,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
  358.     standend();
  359.     refresh();
  360.     getch();
  361.  
  362.     if(isgod==1) country=0;
  363. }
  364.  
  365. produce()
  366. {
  367.     register int xsctr,ysctr;
  368.     short armynum;
  369.     int civilians=0, military=0;
  370.     int ingold=0 ,indesert=0,iniron=0,infood=0;
  371.     int revgold=0,reviron=0,revdesert=0,revfood=0;
  372.     int isgod=0;
  373.  
  374.     if(country==0) {
  375.         isgod=1;
  376.         clear();
  377.         mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
  378.         clrtoeol();
  379.         refresh();
  380.         echo();
  381.         scanw("%hd",&country);
  382.         noecho();
  383.     }
  384.     clear();
  385.     standout();
  386.     mvaddstr(0,(COLS/2)-20,"NEXT YEARS PRODUCTION ESTIMATES");
  387.     standend();
  388.  
  389.     for(xsctr=0;xsctr<MAPX;xsctr++) for(ysctr=0;ysctr<MAPX;ysctr++) if(sct[xsctr][ysctr].owner==country) {
  390.         civilians += sct[xsctr][ysctr].people;
  391.  
  392.         if(sct[xsctr][ysctr].designation==DFARM){
  393.             infood+= sct[xsctr][ysctr].people;
  394.             revfood+=todigit(sct[xsctr][ysctr].vegitation)*sct[xsctr][ysctr].people;
  395.         }
  396.         else if(sct[xsctr][ysctr].designation==DMINE) {
  397.             iniron+= sct[xsctr][ysctr].people;
  398.             reviron+=sct[xsctr][ysctr].iron*sct[xsctr][ysctr].people;
  399.         }
  400.         else if(sct[xsctr][ysctr].designation==DGOLDMINE) {
  401.             ingold+= sct[xsctr][ysctr].people;
  402.             revgold+=sct[xsctr][ysctr].gold*sct[xsctr][ysctr].people;
  403.         }
  404.         else if(((magic(country,DERVISH)==1)||(magic(country,DESTROYER)==1))&&((sct[xsctr][ysctr].vegitation==ICE)||(sct[xsctr][ysctr].vegitation==DESERT))&&(sct[xsctr][ysctr].people>0)) {
  405.             indesert+= sct[xsctr][ysctr].people;
  406.             revdesert+=6*sct[xsctr][ysctr].people;
  407.         }
  408.     }
  409.     if(magic(sct[xsctr][ysctr].owner,MINER)==1) {
  410.         mvaddstr(20,0,"MINER");
  411.         reviron*=2;
  412.         revgold*=2;
  413.     }
  414.  
  415.     standout();
  416.     mvprintw(5,0,  "nation name is ...%s   ",ntn[country].name);
  417.     mvprintw(6,0,  "gold in treasury..$%8d",ntn[country].tgold);
  418.     standend();
  419.     mvaddstr(8,0,  "FOOD PRODUCTION");
  420.     mvprintw(9,0,  "granary now holds......%8ld tons",ntn[country].tfood);
  421.     mvprintw(10,0, "%5d people in farms..%8d tons",infood,revfood);
  422.     if((magic(country,DERVISH)==1)||(magic(country,DESTROYER)==1)) {
  423.     mvprintw(11,0, "dervish: %5d people..%8d tons",indesert,revdesert);
  424.     }
  425.     for(armynum=0;armynum<MAXARM;armynum++) if(ASOLD>0) military+=ASOLD;
  426.     mvprintw(12,0, "%5d civilians eat....%8d tons",civilians,civilians);
  427.     mvprintw(13,0, "%5d soldiers  eat....%8d tons",military,military*2);
  428.     mvprintw(15,0, "TOTAL NET FOOD.........%8d tons",revfood+revdesert-civilians-military*2);
  429.     if(ntn[country].tfood+revfood+revdesert-civilians-military*2<FOODTHRESH*civilians) {
  430.     mvprintw(16,0, "TOTAL NEXT YEARS FOOD..%8ld tons",ntn[country].tfood+revfood+revdesert-civilians-military*2);
  431.     }
  432.     else{
  433.     mvprintw(16,0, "TOTAL NEXT YEARS FOOD..%8ld tons",FOODTHRESH*civilians);
  434.     mvprintw(17,0, "REVENUE FROM EXCESS....%8ld gold",ntn[country].tfood+revfood+revdesert-civilians-military*2-FOODTHRESH*civilians);
  435.     }
  436.  
  437.     mvaddstr(8,40,  "OTHER PRODUCTION");
  438.     mvprintw(10,40, "jewels owned is............%8d",ntn[country].jewels);
  439.     mvprintw(11,40, "%5d people in goldmines :%8d",ingold,revgold);
  440.     mvprintw(12,40, "ESTIMATE NEXT YEARS JEWELS %8d",ntn[country].jewels+revgold);
  441.     mvprintw(14,40, "iron ore owned is..........%8ld",ntn[country].tiron);
  442.     mvprintw(15,40, "%5d people in iron mines:%8d",iniron,reviron);
  443.     mvprintw(16,40, "ESTIMATE NEXT YEARS IRON   %8ld",ntn[country].tiron+reviron);
  444.  
  445.     mvaddstr(20,(COLS/2)-12,"HIT ANY KEY TO CONTINUE");
  446.     refresh();
  447.     getch();
  448.  
  449.     if(isgod==1) country=0;
  450. }
  451.  
  452. /*report on ships and allow changes */
  453. fleetrpt()
  454. {
  455.     short navy;
  456.     short oldx,oldy,oldnavy;
  457.     short done=0;
  458.     int position;
  459.     int count;       /*screen number */
  460.     short nvynum=0;    /*current ship id */
  461.     short wships,mships;
  462.     int isgod=0;
  463.     if(country==0) {
  464.         standout();
  465.         isgod=1;
  466.         clear();
  467.         mvaddstr(0,0,"SUPER USER; FOR WHAT NATION NUMBER:");
  468.         clrtoeol();
  469.         standend();
  470.         refresh();
  471.         echo();
  472.         scanw("%hd",&country);
  473.         if(country<0||country>NTOTAL) return;
  474.         noecho();
  475.     }
  476.  
  477.     count=0;
  478.     for(nvynum=0;nvynum<MAXNAVY;nvynum++) count+=NWAR+NMER;
  479.     if(count==0){
  480.         clear();
  481.         standout();
  482.         mvaddstr(5,(COLS/2)-6, "NO NAVIES ");
  483.         mvaddstr(15,(COLS/2)-14,"HIT ANY KEY TO CONTINUE");
  484.         standend();
  485.         done=1;
  486.         refresh();
  487.         if(isgod==1) country=0;
  488.         return;
  489.     }
  490.     nvynum=0;
  491.     while(done==0) {
  492.         clear();
  493.         /*Operate on any navies that you wish*/
  494.         standout();
  495.         mvprintw(0,(COLS/2)-20,"NAVY STATS SUMMARY FOR %s",ntn[country].name);
  496.         standend();
  497.         /* give a navy report */
  498.  
  499.         mvaddstr(3,0, "warships  :");
  500.         mvaddstr(4,0, "merchant :");
  501.         mvaddstr(5,0, "x location:");
  502.         mvaddstr(6,0, "y location:");
  503.         mvaddstr(7,0,"move left :");
  504.  
  505.         position=5;
  506.         count=0;
  507.         while((nvynum<MAXNAVY)&&(count!=6)){
  508.             if((NWAR+NMER)>0) {
  509.                 count++;
  510.                 position+=10;
  511.                 standout();
  512.                 mvprintw(2,position,"%d:",nvynum);
  513.                 standend();
  514.                 mvprintw(3,position,"%d",NWAR);
  515.                 mvprintw(4,position,"%d",NMER);
  516.                 mvprintw(5,position,"%d",NXLOC);
  517.                 mvprintw(6,position,"%d",NYLOC);
  518.                 mvprintw(7,position,"%d",NMOVE);
  519.             }
  520.             nvynum++;
  521.         }
  522.         if(nvynum>=MAXNAVY) done=1;
  523.  
  524.         standout();
  525.         mvaddstr(12,(COLS/2)-10,"HIT SPACE KEY IF DONE");
  526.         mvaddstr(13,(COLS/2)-14,"HIT RETURN TO CHANGE A NAVY");
  527.         mvaddstr(14,(COLS/2)-14,"HIT ANY OTHER KEY TO CONTINUE");
  528.         standend();
  529.         refresh();
  530.         if ((navy=getch())==' ') done=1;
  531.         if (navy=='\n'){
  532.             mvaddstr(16,0,"WHAT NAVY DO YOU WANT TO CHANGE:");
  533.             clrtoeol();
  534.             refresh();
  535.             echo();
  536.             scanw("%hd",&nvynum);
  537.             noecho();
  538.             if((nvynum<0)||(nvynum>MAXNAVY)) return;
  539.             mvaddstr(18,0,"1) TRANSFER / MERGE, 2) SPLIT NAVY, 3) DISBAND NAVY:");
  540.             clrtoeol();
  541.             refresh();
  542.             switch(getch()){
  543.             case '1':
  544.                 oldx=NXLOC;
  545.                 oldy=NYLOC;
  546.                 oldnavy=nvynum;
  547.                 mvaddstr(22,0,"TO WHAT NAVY: ");
  548.                 clrtoeol();
  549.                 refresh();
  550.                 echo();
  551.                 scanw("%hd",&nvynum);
  552.                 if(nvynum==oldnavy) {
  553.                     mvprintw(23,0,"SORRY -- SAME (%d,%d)",nvynum,oldnavy);
  554.                     refresh();
  555.                     getch();
  556.                 }
  557.                 else if((nvynum<0)||(nvynum>MAXNAVY)){
  558.                     mvprintw(23,0,"SORRY -- INVALID NAVY %d",nvynum);
  559.                     refresh();
  560.                     getch();
  561.                 }
  562.                 else if((oldx==NXLOC)&&(oldy==NYLOC)) {
  563.                     NWAR+=ntn[country].nvy[oldnavy].warships;
  564.                     NMER+=ntn[country].nvy[oldnavy].merchant;
  565.                     NADJSHP;
  566.                     if(NMOVE>ntn[country].nvy[oldnavy].smove)
  567.                         NMOVE=ntn[country].nvy[oldnavy].smove;
  568.                     NADJMOV;
  569.                     nvynum=oldnavy;
  570.                     NWAR=0;
  571.                     NMER=0;
  572.                     NADJSHP;
  573.                 }
  574.                 else {
  575.                     mvaddstr(23,0,"Navies not together (hit any key) ");
  576.                     refresh();
  577.                     getch();
  578.                 }
  579.                 noecho();
  580.                 break;
  581.             case '2':
  582.                 mvaddstr(21,0,"HOW MANY WARSHIPS TO SPLIT: ");
  583.                 clrtoeol();
  584.                 refresh();
  585.                 echo();
  586.                 scanw("%hd",&wships);
  587.                 mvaddstr(21,0,"HOW MANY MERCHANTS TO SPLIT: ");
  588.                 clrtoeol();
  589.                 refresh();
  590.                 scanw("%hd",&mships);
  591.                 noecho();
  592.                 if((wships<NWAR)&&(mships<NMER)){
  593.                     NWAR-=wships;
  594.                     NMER-=mships;
  595.                     NADJSHP;
  596.                     oldnavy=nvynum;
  597.                     oldx=NXLOC;
  598.                     oldy=NYLOC;
  599.                     navy=(-1);
  600.                     for(nvynum=0;nvynum<MAXNAVY;nvynum++)
  601.                         if((NWAR+NMER==0)&&(navy==(-1))) 
  602.                             navy=nvynum;
  603.                     nvynum=navy;
  604.                     /*overflow*/
  605.                     if(nvynum==(-1)) {
  606.                         mvaddstr(23,0,"TOO MANY NAVIES: ");
  607.                         nvynum=oldnavy;
  608.                         NWAR+=wships;
  609.                         NMER+=mships;
  610.                         NADJSHP;
  611.                     }
  612.                     else {
  613.                         NMOVE=ntn[country].nvy[oldnavy].smove;
  614.                         NXLOC=oldx;
  615.                         NYLOC=oldy;
  616.                         NWAR=wships;
  617.                         NMER=mships;
  618.                         NADJSHP;
  619.                         NADJLOC;
  620.                         NADJMOV;
  621.                     }
  622.                 }
  623.                 else {
  624.                     mvaddstr(23,0,"TOO MANY SHIPS: ");
  625.                     refresh();
  626.                     getch();
  627.                 }
  628.                 break;
  629.             case '3':
  630.                 NWAR=0;
  631.                 NMER=0;
  632.                 NADJSHP;
  633.                 break;
  634.             default:
  635.                 mvaddstr(21,0,"ERROR : HIT ANY CHAR TO CONTINUE");
  636.                 clrtoeol();
  637.                 refresh();
  638.                 getch();
  639.             }
  640.             noecho();
  641.             nvynum=0;
  642.         }
  643.     }
  644.     if(isgod==1) country=0;
  645. }
  646.